﻿using System;
using System.Data;
using System.Data.Common;
using ylyfDataCommon.Exceptions;

namespace ylyfDataConnectionManager.Common
{
    public abstract class HiDbBaseClass
    {
        protected HiDataBase db;
        public HiDbBaseClass(HiDataBase DataBase)
        {
            if (DataBase == null)
            {
                throw new NullReferenceException();
            }
            db = DataBase;
        }

        public DbParameter CreateParameter(string name, Object value = null)
        {
            return db.CreateParameter(name, value);
        }



        public DbParameter CreateParameter(string name, Object value, DbType dbtype, int size,
            ParameterDirection direction = ParameterDirection.InputOutput, bool IsNullable = true)
        {
            var parameter = CreateParameter(name, value, dbtype, size, direction, IsNullable);
            return parameter;
        }
    }
}